
var netUtil = require('/../../utils/netUtil.js');
var util = require('/../../utils/util.js');
var app = getApp();

Page({
  data:{
 		typeAndGoodArray : [[] , []],   //用户显示 选择品种picker的属性
 		respTypeAndGoodArray : null,
 		outItems : [],
 		
 		batchNumArray : [],
 		showBatchNumObjectArray : null,
 		showBatchNumIndex : null,       //需要选择批次的记录下标
 		isShowChooseBatchNum : false,
 		chooseBatchNumHint : '点击选择批次!',
 		
 		sendSmsCodeText : '发送验证码',
 		smsCodeBoxShow : false,
 		verifyCode : '',
 		phoneNum : '',
 		sendSmsInteval : null,
 		logisticsCompany : '',
 		logisticsCompanyArray : getApp().globalData.logisticsCompanyArray,
 		
 		customerAddressList : [],
 		selectAddressCode : null,
 		selectAddressName : '',
 		selectReceiver : null,
 		selectPhoneNum : null,
 		isShowChooseAddress : false
  },

onLoad:function(options){

  	var that = this;
  		
  	//检查是否已经 注册
   	app.checkHasRegister('MAKETEA',function(phone) {
   		 	
   		that.setData({
   		 	phoneNum : phone
   		});
   		 		
   		app.getUserOpedId(that.getAllTypeAndGoods);
   		
   		app.getUserOpedId(that.queryCustomerAddressList);
   		
   		app.getUserOpedId(function() {
  		
  		var params = {
  			method : 'wechat.wisen.address.userInfo.query',
  			openId : app.globalData.userInfo.openid
  		}
  		
  		netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					console.log(resp);
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
										
						var customerAddressList = resp.data;
						that.setData({
							customerAddressList : customerAddressList
						});
						
 					} else {
						if(resp.message != undefined && resp.message != null && resp.message != '') {
 							netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 						} else {
 							netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 						}
					}
					
				},
				
				onError: function(res) {
					console.log("fail");
					netUtil.hideLoadingDialog(that);
					netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
				}
				
			}).send();
  		
  	});
   		
   	});
  },
  onReady:function(){
  
  },
  onShow:function(){
    
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },

  onUnload:function(){
    // 页面关闭

  },
  
  bindSelectAddressChange : function(e) {
  	
  	this.setData({
  		isShowChooseBatchNum : false,
  		isShowChooseAddress : true, 	
  	});
  

  	
  /*	var value = e.detail.value;
  	var addressObj = this.data.customerAddressList[value];
  	this.setData({
  		selectAddressCode : addressObj.code,
  		selectAddressName : addressObj.address,
  		selectReceiver : addressObj.receiver,
  		selectPhoneNum : addressObj.phoneNum
  	});*/
  },
  
  selectAddress : function(e) {
  	var arrayIndex = e.currentTarget.dataset.arrayindex;
  	var addressObj = this.data.customerAddressList[arrayIndex];
  	this.setData({
  		selectAddressCode : addressObj.code,
  		selectAddressName : addressObj.address,
  		selectReceiver : addressObj.receiver,
  		selectPhoneNum : addressObj.phoneNum,
  		isShowChooseBatchNum : false,
  		isShowChooseAddress : false, 	
  	});
  },
  
  //查询用户收货地址
  queryCustomerAddressList : function() {
  	var that = this;
  	
  	app.getUserOpedId(function() {
  		
  		var params = {
  			method : 'wechat.wisen.address.userInfo.query',
  			openId : app.globalData.userInfo.openid
  		}
  		
  		netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					console.log(resp);
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
										
						var customerAddressList = resp.data;
						
						for(var i=0;i<customerAddressList.length;i++) {
							var customerAddressObj = customerAddressList[i];
							customerAddressObj.showKey = customerAddressObj.address + '\r\n\r\n' + customerAddressObj.receiver + '\r\n\r\n' + customerAddressObj.phoneNum;
						}
						
						that.setData({
							customerAddressList : customerAddressList
						});
						
 					} else {
						if(resp.message != undefined && resp.message != null && resp.message != '') {
 							netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 						} else {
 							netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 						}
					}
					
				},
				
				onError: function(res) {
					console.log("fail");
					netUtil.hideLoadingDialog(that);
					netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
				}
				
			}).send();
  		
  	});
  },
  
  addGetTeaItem : function(e) {
  	
  	var that = this;
  	
  	var outItems = this.data.outItems;
  	//如果有记录，就去最后一条记录出来，发送数据到后台查询 库存是否足够
  	if(outItems != null && outItems.length > 0) {
  		var checkItem = outItems[outItems.length - 1];
      
  		
  		if(checkItem.goodsId != null && checkItem.goodsId != ''
  			 && (checkItem.packageQuantity != 0 || checkItem.unitQuantity != 0) && checkItem.batchNum != null && checkItem.batchNum != '') {
        var goodsId = checkItem.goodsId;
        var proBatch = checkItem.batchNum;
        for (var i = 0; i < outItems.length - 1; i++) {
          var target = outItems[i];
          if (target.goodsId == goodsId && target.batchNum == proBatch) {
            netUtil.showAlertDialog("提示", "第【" + i + 1 + "】条明细商品一样，请到此处修改！", false, "确定", null, null);
            return;
          }
        }
  			 		//发送请求去后台检查库存
  			 		var params = {
  						method : 'wechat.wisen.whbalance.num.check',
  						openId : app.globalData.userInfo.openid,
  						data : {
  							outItems : [checkItem]
  						}
  					};
  										
  		      netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
			      	
			      	onPre: function() {
			      		netUtil.showLoadingDialog(that);
			      	},
			      	
			      	onSuccess: function(resp) {
			      		
			      		netUtil.hideLoadingDialog(that);
			      		
			      		if(resp.ret == app.globalData.respSuccessCode) {
			      				var teaItem = {
			     						 	goodsId : '',
			      						goodsName : '',
			      						unitQuantity : 0,
			      						packageQuantity :0,
			      						batchNum : ''
			     					};
			     					that.data.batchNumArray.push([])
			     					that.data.outItems.push(teaItem);
			      				that.setData({
			      					outItems : that.data.outItems,
			      					batchNumArray : that.data.batchNumArray
			      				});				
			      			
 			      		} else {
			      			if(resp.message != undefined && resp.message != null && resp.message != '') {
 			      				netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 			      			} else {
 			      				netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 			      			}
			      		}
			      		
			      	},
			      	
			      	onError: function(res) {
			      		console.log("fail");
			      		netUtil.hideLoadingDialog(that);
			      		netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
			      	}
			      	
			      }).send();
  			 				 		
  			 } else {
  			 		var teaItem = {
			      	goodsId : '',
			      	goodsName : '',
			      	unitQuantity : 0,
			      	packageQuantity :0,
			      	batchNum : ''
			      };
			      this.data.batchNumArray.push([])
			      this.data.outItems.push(teaItem);
			      this.setData({
			      	outItems : this.data.outItems,
			      	batchNumArray : this.data.batchNumArray
			      });
  			 }
  		
  	} else {
  			var teaItem = {
					goodsId : '',
					goodsName : '',
					unitQuantity : 0,
					packageQuantity :0,
					batchNum : ''
				};
				this.data.batchNumArray.push([])
				this.data.outItems.push(teaItem);
				this.setData({
					outItems : this.data.outItems,
					batchNumArray : this.data.batchNumArray
				});
  	}
  	
  },
  
  //批次选择确定时间
  bindBatchNumChange : function(e) {
  	
  //	var value = e.detail.value;
  
 		var arrayIndex = e.currentTarget.dataset.initemsindex;
  	
  	//如果没有选择茶品为空
  	if(this.data.outItems[arrayIndex].goodsName == '' || this.data.outItems[arrayIndex].goodsName == null) {
  		netUtil.showAlertDialog("提示", '请先选择茶品', false, "确定", null, null);
  		return;
  	}
  	
  	var showBatchNumObjectArray = this.data.batchNumArray[arrayIndex];
  	
  	var chooseBatchNumHint = '';
  	if(showBatchNumObjectArray == null || showBatchNumObjectArray.length <= 0) {
  			chooseBatchNumHint = '尊敬的茶主：本茶品没有库存';
  	} else {	
  			chooseBatchNumHint = '点击选择批次!';
  	}
  	
  	this.setData({
  		showBatchNumObjectArray : showBatchNumObjectArray,
  		isShowChooseBatchNum : true,
  		isShowChooseAddress : false,
  		showBatchNumIndex : arrayIndex,
  		chooseBatchNumHint : chooseBatchNumHint
  	});
  	
  /*	var batchNumObj = this.data.batchNumArray[arrayIndex][value];
  	var batchNum = batchNumObj.productionBatchNo;
  	
  	this.data.outItems[arrayIndex].batchNum = batchNum;
  	this.setData({
  		outItems : this.data.outItems
  	});*/
  	
  },
  
  chooseBatchNum : function(e) {
  		var productionBatchNo = e.currentTarget.dataset.productionbatchno;
  		this.data.outItems[this.data.showBatchNumIndex].batchNum = productionBatchNo;
 			this.setData({
 				outItems : this.data.outItems,	
 				isShowChooseBatchNum : false
 			})
  },
  
  hideChooseBatchNum : function(e) {
  	this.setData({
 				isShowChooseBatchNum : false
 		})
  },
  	
  bindLogisticsCompanyChange : function(e) {
  	var value = e.detail.value;
  	var logisticsCompany = this.data.logisticsCompanyArray[value].logisticsCompany;
  	this.setData({
  		logisticsCompany : logisticsCompany
  	});
   },
  
    //列值改变事件
  bindTypeAndGoodsColumnChange : function(e) {
  	
  	var column = e.detail.column;
  	var value = e.detail.value;
  
  	//如果改变第一列
  	if(column == 0) {
  		this.data.typeAndGoodArray[1] = this.data.respTypeAndGoodArray[1][value];
  		this.setData({
  			typeAndGoodArray : this.data.typeAndGoodArray
  		});
  	}
  },
  
  //列值确定事件
  bindTypeAndGoodsChange :function(e) {
	
		var that = this;
  	var value = e.detail.value;
 
  	//由于小程序的bug，第二列动态切换后，如果选择切换后默认的第一个，数据的第二个元素返回 null
  	for(var i=0;i<value.length;i++) {
  		var columnValue = value[i];
  		if(columnValue == null || columnValue == undefined) {
  			value[i] = 0;
  		}
  	}
  	
  	var arrayIndex = e.currentTarget.dataset.initemsindex;
  	var selectGoddIndex = value[1];
   	
  	//1.设置数据对应下标的值
  	var selectedGoodObj = that.data.typeAndGoodArray[1][selectGoddIndex];
  	that.data.outItems[arrayIndex].goodsId = selectedGoodObj.goodsId;
  	that.data.outItems[arrayIndex].goodsName = selectedGoodObj.goodsName;
    that.data.outItems[arrayIndex].batchNum = '';
  	that.setData({
			outItems : that.data.outItems
		});
  	
  	var selectGoodsId = selectedGoodObj.goodsId;
  	var selectGoodsName = selectedGoodObj.goodsName;
  	
  	var params = {
  		method : 'wechat.wisen.whbalance.balance.query',
  		openId : app.globalData.userInfo.openid,
  		data : {
  			goodsName : selectGoodsName
  		}
  		
  	}
  	
  	//选择商品后，发送请求到后台查询批次号，然后设置数据 setData
  		netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					
					/*{"data":[{"productionBatchNo":"2018-06-06"},{"productionBatchNo":"2018-07-03"},{"productionBatchNo":"2018-07-04"}],"ret":0}*/
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
										
							var respBatchNumArray = resp.data;
							that.data.batchNumArray[arrayIndex] = respBatchNumArray;
							
							that.setData({
								batchNumArray : that.data.batchNumArray,
								isShowChooseBatchNum : false
							});
								
 					} else {
						if(resp.message != undefined && resp.message != null && resp.message != '') {
 							netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 						} else {
 							netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 						}
					}
					
				},
				
				onError: function(res) {
					console.log("fail");
					netUtil.hideLoadingDialog(that);
					netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
				}
				
			}).send();
  	
  },
  
  //选择数量
	inputTeaCount : function(e) {
		var initemsindex = e.currentTarget.dataset.initemsindex;
		var packageQuantity = e.detail.value;
		
		this.data.outItems[initemsindex].packageQuantity = packageQuantity;
		
		this.setData({
			outItems : this.data.outItems
		});	
	},
	
	 //选择数量
	inputUnitQuantity : function(e) {
		var initemsindex = e.currentTarget.dataset.initemsindex;
		var unitQuantity = e.detail.value;
		
		this.data.outItems[initemsindex].unitQuantity = unitQuantity;
		
		this.setData({
			outItems : this.data.outItems
		});	
	},
	
	reduceGetTeaItem : function(e) {
		var initemsindex = e.currentTarget.dataset.initemsindex;
		this.data.outItems.splice(initemsindex,1);
		this.setData({
			outItems : this.data.outItems
		})
	},
	
	doSubmitGetTea : function(e) {
		
		var that = this;
		
		var newOutItems = [];
		
		for(var i=0;i<that.data.outItems.length;i++) {
			
			var checkItem = that.data.outItems[i];
			
			if(checkItem.goodsId != null && checkItem.goodsId != ''
  			 && (checkItem.packageQuantity != 0 || checkItem.unitQuantity != 0) && checkItem.batchNum != null && checkItem.batchNum != '') {
  			 	newOutItems.push(checkItem);
  			 }
		}
		
		if(newOutItems.length <= 0) {
			netUtil.showAlertDialog("提示", '没有有效的记录', false, "确定", null, null);
			return;
		}
		
		var params = {
  		method : 'wechat.wisen.out.voucher.save',
  		openId : app.globalData.userInfo.openid,
  		data : {
  			outItems : newOutItems,
  			logisticsCompany : that.data.logisticsCompany,
  			code : that.data.selectAddressCode
  		}
 		 };
 		 
 		 		netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
										
						//提茶成功后，跳转到订单页	
							wx.reLaunch({
								url: '/pages/order/order?from=getTea'
							});
						
 					} else {
						if(resp.message != undefined && resp.message != null && resp.message != '') {
 							netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 						} else {
 							netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 						}
					}
					
				},
				
				onError: function(res) {
					console.log("fail");
					netUtil.hideLoadingDialog(that);
					netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
				}
				
			}).send();
		
	},
	
	//提交提茶申请
	submitGetTea : function(e) {
		var that = this;	
		
			//如果没有选择物流公司
  	if(that.data.logisticsCompany == null || that.data.logisticsCompany == '') {
  		netUtil.showAlertDialog("提示", '请选择物流公司', false, "确定", null, null);
  		return;
  	}
		
		var outItems = that.data.outItems;
  	//如果有记录，就去最后一条记录出来，发送数据到后台查询 库存是否足够
  	if(outItems != null && outItems.length > 0) {
  		var checkItem = outItems[outItems.length - 1];
  		
  		if(checkItem.goodsId != null && checkItem.goodsId != ''
  			 && (checkItem.packageQuantity != 0 || checkItem.unitQuantity != 0) && checkItem.batchNum != null && checkItem.batchNum != '') {
        var goodsId = checkItem.goodsId;
        var proBatch = checkItem.batchNum;
        for (var i = 0; i < outItems.length - 1; i++) {
          var target = outItems[i];
          if (target.goodsId == goodsId && target.batchNum == proBatch) {
            netUtil.showAlertDialog("提示", "第【" + i + 1 + "】条明细商品一样，请到此处修改！", false, "确定", null, null);
            return;
          }
        }
  			 		//发送请求去后台检查库存
  			 		var params = {
  						method : 'wechat.wisen.whbalance.num.check',
  						openId : app.globalData.userInfo.openid,
  						data : {
  							outItems : [checkItem]
  						}
  					};
  										
  		      netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
			      	
			      	onPre: function() {
			      		netUtil.showLoadingDialog(that);
			      	},
			      	
			      	onSuccess: function(resp) {
			      		
			      		netUtil.hideLoadingDialog(that);
			      		
			      		if(resp.ret == app.globalData.respSuccessCode) {
			      			
			      				that.setData({
 		 									smsCodeBoxShow : true,
 										});
			      			
 			      		} else {
			      			if(resp.message != undefined && resp.message != null && resp.message != '') {
 			      				netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 			      			} else {
 			      				netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 			      			}
			      		}
			      		
			      	},
			      	
			      	onError: function(res) {
			      		console.log("fail");
			      		netUtil.hideLoadingDialog(that);
			      		netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
			      	}
			      	
			      }).send();
  			 				 		
  			} else {
  			 	that.setData({
 		 				smsCodeBoxShow : true,
 					});
  			}
  		
  	} else {
  		that.setData({
 		 		smsCodeBoxShow : true,
 			});
  	}
	},
	
	  //点击发送验证码触发的方法
  sendSms:function() {
  	
  	var that = this;
  	
  	//如果已经发送过验证码，一分钟倒计时还没完成，不做处理
  	if(that.data.sendSmsCodeText != '发送验证码') {
  			var secStr = '';

				if(that.data.sendSmsCodeText.length == 6) {
					secStr = that.data.sendSmsCodeText.substring(0, 2);
				} else {
					secStr = that.data.sendSmsCodeText.substring(0, 1);
				}

				var secInt = parseInt(secStr);
				var newSecInt = secInt - 1;

				if(newSecInt <= 0) {

					this.setData({
						sendSmsCodeText: '发送验证码'
					});

					clearInterval(that.data.sendSmsInteval);

					that.setData({
						sendSmsInteval: null
					});

				} else {
					that.setData({
						sendSmsCodeText: newSecInt + '秒后重发'
					});
				}
  		return;
  	}
  	
  	var phoneNum = this.data.phoneNum;
  	if(phoneNum != null && phoneNum.length == 11 && util.isPoneAvailable(phoneNum)) {
  		
  		app.getUserOpedId(function() {
  			
  			var params = {
  				method : 'wechat.wisen.commom.verify.generate',
  				openId : app.globalData.userInfo.openid,
  				data : {
  					phoneNum : that.data.phoneNum
  				}
  			};
  				
  			netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
								
						  	if('发送验证码' == that.data.sendSmsCodeText) {
						  		var text = '60秒后重发';
						  		that.setData({
						  			sendSmsCodeText: text
						  		});

						  		var sendSmsInteval = setInterval(that.sendSms, 1000);

						  		that.setData({
						  			sendSmsInteval: sendSmsInteval
						  		});

						  	} 
						
 						} else {
							if(resp.message != undefined && resp.message != null && resp.message != '') {
 								netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 							} else {
 								netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 							}
						}
					
					},
				
					onError: function(res) {
						 console.log("fail");
						 netUtil.hideLoadingDialog(that);
						 netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
					}
				
				}).send();
  				
  		});
  		
  	} else {
  		 netUtil.showAlertDialog("提示", '请输入正确手机号码', false, "确定", null, null);
  	}
  },
  
     //检查验证码是否正确
  checkSmsCode : function(e) {
  	
  	var that = this;
  	
  	var verifyCode = that.data.verifyCode;
  	
  	//发送请求检查验证码
  	if(verifyCode != null && verifyCode != '') {
  		app.getUserOpedId(function() {
  			var params = {
  				method : 'wechat.wisen.commom.verify.check',
  				openId : app.globalData.userInfo.openid,
  				data : {
  					phoneNum : that.data.phoneNum,
  					verifyCode : verifyCode
  				}
  			};
  			
  			netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
  				onPre: function() {
						
					},
					
					onSuccess: function(resp) {
						
						//如果验证码正确，不做处理
						if(resp.ret == app.globalData.respSuccessCode) {
							
							that.hideSmsCodeBox();
							
							that.doSubmitGetTea();
						
						} else {   //验证码错误，弹出提示框
							netUtil.showAlertDialog("提示",resp.message, false, "确定", null, null);
						}
					},
					
					onError: function(res) {
						 console.log("fail");
						 netUtil.hideLoadingDialog(that);
						 netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
					}
					
  			}).send();
  			
  		});
  	}
  },
  
  hideSmsCodeBox : function() {
		this.setData({
			smsCodeBoxShow : false,
			verifyCode : ''
		})
	},
	
	inputSmsCode: function(e) {

		var verifyCode = e.detail.value;
		this.setData({
			verifyCode : verifyCode
		});
	},
	 
  //查询所有类别和商品
	getAllTypeAndGoods : function() {
		var that = this;
		
		var params = {
  		method : 'wechat.wisen.goods.all.query',
  		openId : app.globalData.userInfo.openid
  	}
		
		netUtil.buildRequest(that,'/wisen/api/wechat/ret',params,{
				
				onPre: function() {
					netUtil.showLoadingDialog(that);
				},
				
				onSuccess: function(resp) {
					
					netUtil.hideLoadingDialog(that);
					
					if(resp.ret == app.globalData.respSuccessCode) {
										
						var data = resp.data;
						
						var typeArray = data[0];
						var goodsArray = data[1];
						
						that.data.typeAndGoodArray[0] = typeArray;
						that.data.typeAndGoodArray[1] = goodsArray[0];
						
						that.setData({
							typeAndGoodArray : that.data.typeAndGoodArray,
							respTypeAndGoodArray : data
						});
						
 					} else {
						if(resp.message != undefined && resp.message != null && resp.message != '') {
 							netUtil.showAlertDialog("提示", resp.message, false, "确定", null, null);
 						} else {
 							netUtil.showAlertDialog("提示", "网络请求失败", false, "确定", null, null);
 						}
					}
					
				},
				
				onError: function(res) {
					console.log("fail");
					netUtil.hideLoadingDialog(that);
					netUtil.showAlertDialog("提示", msgCanShow, false, "确定", null, null);
				}
				
			}).send();
		
	}

})